package controller;

import java.util.List;

import com.jfinal.captcha.CaptchaRender;
import com.jfinal.core.Controller;

import io.netty.buffer.Unpooled;
import io.netty.util.CharsetUtil;
import model.Weather;
import server.MyServerHandler;

public class TestController extends Controller {
	  
	public void index(){
		List<Weather> weather = Weather.dao.find("select * from weather");
		setAttr("weather",weather);
		render("test.jsp");
	}
	public void img() {  
	        CaptchaRender img = new CaptchaRender();  
	        render(img);  
	    }  
	//实现数据获取
//	@CacheName("bbsRedis")
	public void GetData(){
		if(MyServerHandler.Get()!=null)
			MyServerHandler.Get().writeAndFlush(Unpooled.copiedBuffer("Select All data!",CharsetUtil.UTF_8));
		index();
	}
	//实现数据刷新
//	@CacheName("bbsRedis")
	public void Refresh(){
		index();
	}
}
